package com.weipt.juc.function;

import java.util.function.Predicate;

/**
 * @author peter.wei 2020/09/28 15:57
 * @version 1.0
 * @company 终生学习
 * @description <br>peter.wei 2020/09/28 15:57
 **/
public class TestPredicate {

    public static void main(String[] args) {
        Predicate<String> innnerPredicate = new Predicate<String>() {
            @Override
            public boolean test(String o) {
                if("peter".equals(o))
                    return true;
                else
                    return false;
            }
        };
        System.out.println(innnerPredicate.test("peter"));

        Predicate<String> predicate =t-> "peter".equals(t);
        System.out.println(predicate.test("peter"));

        System.out.println(test(m -> "peter".equals(m), "peter"));
    }


    private static boolean test(Predicate<String> predicate, String t){
        return predicate.test(t);
    }
}